import { useThrottleFn } from 'ahooks';
import { router } from '@ray-js/ray';

export default function useHandleJump() {
  const handleJump = useThrottleFn(
    (code: string) => {
      router.push(`/${code}`);
    },
    { wait: 80 }
  ).run;

  return handleJump;
}
